
package projForWen;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 *
 * @author Bacteria
 * Created on 2013-2-1, 11:40:43
 */
public class ListIcon {
    private Icon icon;
    private String text;
    
    public ListIcon(String icon, String text){
        BufferedImage img = null;
        try {
            img = ImageIO.read(new File(icon));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        BufferedImage imgNew = new BufferedImage(200, 100, img.getType());
        Graphics g = imgNew.getGraphics();
        g.drawImage(img, 0, 0, 200, 100, null);
        this.icon =new ImageIcon(imgNew);
        this.text = text;               
    }
    public Icon getIcon() { 
        return icon;
    }
    public String getText() { 
        return text;
    }
}
